{include file="public/layout" /}
<body class="bodystyle" style="cursor: default; -moz-user-select: inherit; min-width:400px;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page" style="min-width: 400px;">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back" href="{:url('System/api_conf')}" title="返回"><i class="fa fa-angle-double-left"></i>返回</a>
            <ul class="tab-base nc-row">
                {eq name="'System@sms'|is_check_access" value="1"}
                <li><a href="{:url('System/sms')}" {if condition="'sms'==$Think.const.ACTION_NAME"}class="current"{/if}><span>短信配置</span></a></li>
                {/eq}

                {eq name="'System@sms_tpl'|is_check_access" value="1"}
                <li><a href="{:url('System/sms_tpl')}" {if condition="'sms_tpl'==$Think.const.ACTION_NAME"}class="current"{/if}><span>自定义模板</span></a></li>
                {/eq}
            </ul>
        </div>
    </div>
    <div class="flexigrid">
        {empty name='$is_conf'}
        <!-- 操作说明 -->
        <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
            <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
                <h4 title="提示相关设置操作时应注意的要点">提示</h4>
                <span title="收起提示" id="explanationZoom" style="display: block;"></span>
            </div>
            <ul>
                <li style="color: red;">提示：短信尚未配置信息，全站短信功能将无法使用。</li>
            </ul>
        </div>
        {/empty}

        <div class="mDiv">
            <div class="ftitle">
                <div class="member-nav-group">
                    <label class="member-nav-item">
                        <input type="button" class="btn {if condition="$sms_type == 1"}selected{else/}current{/if}" value="阿里云短信" onclick="window.location.href='{:url("System/sms_tpl", ["sms_type"=>1])}';">
                    </label>
                    <label class="member-nav-item">
                        <input type="button" class="btn {if condition="$sms_type == 2"}selected{else/}current{/if}" value="腾讯云短信" onclick="window.location.href='{:url("System/sms_tpl", ["sms_type"=>2])}';">
                    </label>
                </div>
            </div>
        </div>

        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0" style="width: 100%">
                    <thead>
                    <tr>
                        <th abbr="article_title" axis="col3" class="w100">
                            <div class="text-l10">模板类型</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="w230">
                            <div class="text-l10">签名名称</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="w230">
                            <div class="text-l10">{eq name="$sms_type" value="1"}模板CODE{else /}模板id{/eq}</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="">
                            <div class="text-l10">模板内容</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w50">
                            <div class="tc">启用</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w100">
                            <div class="tc">更新时间</div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table style="width: 100%">
                    <tbody>
                    {empty name="list"}
                        <tr>
                            <td class="no-data" align="center" axis="col0" colspan="50">
                                <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                            </td>
                        </tr>
                    {else/}
                        {foreach name="list" item="vo" key="k" }
                        <tr>
                            <td class="">
                                <div class="w100 text-l10">
                                    {$vo.tpl_title}
                                </div>
                            </td>
                            <td class="">
                                <div class="w230">
                                    {php}
                                        $disabled_str = '';
                                        $web_users_switch = !empty($global['web_users_switch']) ? $global['web_users_switch'] : 0;
                                        if ((empty($shop_open) || $php_servicemeal <= 1) && in_array($vo['send_scene'], [5,6])) {
                                            $disabled_str = 'disabled="disabled" title="请开启商城中心"';
                                        } else if (empty($web_users_switch) && in_array($vo['send_scene'], [0,1,4])) {
                                            $disabled_str = 'disabled="disabled" title="请开启会员中心"';
                                        }
                                    {/php}
                                    <input type="text" name="sms_sign" value="{$vo.sms_sign}" onchange="changeTableVal('sms_template','tpl_id','{$vo.tpl_id}','sms_sign',this);" style="width: 80%;" placeholder="短信签名名称，例：易优" {$disabled_str}>
                                </div>
                            </td>
                            <td class="">
                                <div class="w230">
                                    <input type="text" name="sms_tpl_code" value="{$vo.sms_tpl_code}" onchange="changeTableVal('sms_template', 'tpl_id', '{$vo.tpl_id}', 'sms_tpl_code', this);" style="width: 80%;" placeholder="{eq name="$sms_type" value="1"}短信模板CODE，例：SMS_123456789{else /}短信模板id，例：123456789{/eq}" {$disabled_str}>
                                </div>
                            </td>
                            <td style="width: 100%">
                                <div class="">
                                    <input type="text" name="tpl_content" value="{$vo.tpl_content}" onchange="changeTableVal('sms_template', 'tpl_id', '{$vo.tpl_id}', 'tpl_content', this);" style="width: 94%;" placeholder="{eq name="$sms_type" value="1"}短信模板内容，例：验证码为 ${content} ，请在30分钟内输入验证。{else /}验证码为：{1}，您正在登录，若非本人操作，请勿泄露。{/eq}" {$disabled_str}>
                                </div>
                            </td>
                            <td class="">
                                <div class="w50 tc">
                                    {eq name="$vo['is_open']" value='1'}
                                        <span class="yes" onClick="changeTableVal('sms_template', 'tpl_id', '{$vo.tpl_id}', 'is_open', this);"><i class="fa fa-check-circle"></i>是</span>
                                    {else /}
                                        <span class="no" onClick="changeTableVal('sms_template', 'tpl_id', '{$vo.tpl_id}', 'is_open', this);"><i class="fa fa-ban"></i>否</span>
                                    {/eq}
                                </div>
                            </td>
                            <td class=""> 
                                <div class="w100 tc">
                                    {$vo.update_time|MyDate='Y-m-d',###}
                                </div>
                            </td>
                        </tr>
                        {/foreach}
                    {/empty}
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        <div class="tDiv">
            <div class="tDiv2">
                {include file="public/page" /}
            </div>
            <div style="clear:both"></div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });
    });
</script>

{include file="public/footer" /}